using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;

namespace SearchWinForm
{
    public partial class Form1 : Form
    {

        string url = "https://www.baidu.com/s?wd=";

        public Form1()
        {
            InitializeComponent();
        }

        private void search_Click(object sender, EventArgs e)
        {
            Task task = new Task(() => { searchInBaidu(); });
            task.Start();
        }

        private void searchInBaidu()
        {
            WebClient webClient = new WebClient();
            byte[] pageData = webClient.DownloadData(url+searchTextBox);
            string result = Encoding.UTF8.GetString(pageData);
            this.BeginInvoke(new MyDelegate(() => { outPutTextBox.Text = result.Substring(0, 200); }));
        }

        private delegate void MyDelegate();
    }
}